home *** CD-ROM | disk | FTP | other *** search
/ 3D Images / 3D Images.iso / programs / amiga / rayshade / include / rle_put.h < prev    next >
C/C++ Source or Header  |  1995-01-12  |  3KB  |  85 lines

  1. /*
  2.  * This software is copyrighted as noted below.  It may be freely copied,
  3.  * modified, and redistributed, provided that the copyright notice is 
  4.  * preserved on all copies.
  5.  * 
  6.  * There is no warranty or other guarantee of fitness for this software,
  7.  * it is provided solely "as is".  Bug reports or fixes may be sent
  8.  * to the author, who may or may not act on them as he desires.
  9.  *
  10.  * You may not include this software in a program or other software product
  11.  * without supplying the source, or without informing the end-user that the 
  12.  * source is available for no extra charge.
  13.  *
  14.  * If you modify this software, you should include a notice giving the
  15.  * name of the person performing the modification, the date of modification,
  16.  * and the reason for such modification.
  17.  */
  18. /* 
  19.  * rle_put.h - Definitions and a few global variables for rle_putrow/putraw.
  20.  * 
  21.  * Author:    Spencer W. Thomas
  22.  *         Computer Science Dept.
  23.  *         University of Utah
  24.  * Date:    Mon Aug  9 1982
  25.  * Copyright (c) 1982 Spencer W. Thomas
  26.  * 
  27.  * $Id: rle_put.h,v 3.0 90/08/03 15:19:51 spencer Exp $
  28.  */
  29.  
  30. #include <rle.h>
  31.  
  32. /* ****************************************************************
  33.  * Dispatch table for different output types.
  34.  */
  35. #ifdef c_plusplus
  36. #define ARB_ARGS ...
  37. #else
  38. #define ARB_ARGS
  39. #endif
  40.  
  41. typedef int rle_fn( ARB_ARGS );
  42.  
  43. struct rle_dispatch_tab {
  44.     CONST_DECL char   *magic;    /* magic type flags */
  45.     rle_fn *setup,            /* startup function */
  46.        *skipBlankLines,
  47.        *setColor,
  48.        *skipPixels,
  49.        *newScanLine,
  50.        *putdat,            /* put a set of differing pixels */
  51.        *putrn,            /* put a run all the same */
  52.        *blockHook,            /* hook called at start of new */
  53.                     /* output block */
  54.        *putEof;        /* write EOF marker (if possible) */
  55. };
  56.  
  57. extern struct rle_dispatch_tab rle_DTable[];
  58.  
  59. /* 
  60.  * These definitions presume the existence of a variable called
  61.  * "fileptr", declared "long * fileptr".  *fileptr should be
  62.  * initialized to 0 before calling Setup().
  63.  * A pointer "the_hdr" declared "rle_hdr * the_hdr" is also
  64.  * presumed to exist.
  65.  */
  66. #define        rle_magic        (rle_DTable[(int)the_hdr->dispatch].magic)
  67. #define        Setup()        (*rle_DTable[(int)the_hdr->dispatch].setup)(the_hdr)
  68. #define        SkipBlankLines(n)    (*rle_DTable[(int)the_hdr->dispatch].skipBlankLines)(n, the_hdr)
  69. #define        SetColor(c)        (*rle_DTable[(int)the_hdr->dispatch].setColor)(c, the_hdr)
  70. #define        SkipPixels(n, l, r)    (*rle_DTable[(int)the_hdr->dispatch].skipPixels)(n,l,r, the_hdr)
  71. #define        NewScanLine(flag)    (*rle_DTable[(int)the_hdr->dispatch].newScanLine)(flag, the_hdr)
  72. #define        putdata(buf, len)    (*rle_DTable[(int)the_hdr->dispatch].putdat)(buf, len, the_hdr)
  73. #define        putrun(val, len, f)    (*rle_DTable[(int)the_hdr->dispatch].putrn)(val,len,f, the_hdr)
  74. #define        BlockHook()        (*rle_DTable[(int)the_hdr->dispatch].blockHook)(the_hdr)
  75. #define        PutEof()        (*rle_DTable[(int)the_hdr->dispatch].putEof)(the_hdr)
  76.  
  77. /* 
  78.  * States for run detection
  79.  */
  80. #define    DATA    0
  81. #define    RUN2    1
  82. #define RUN3    2
  83. #define    RUN4    3
  84. #define    INRUN    -1
  85.